//
//  BaseTableViewController.m
//  iOS07-Weibo-LPK-OC
//
//  Created by 罗培克 on 6/28/15.
//  Copyright © 2015 lpk. All rights reserved.
//

#import "BaseTableViewController.h"
#import "VisitorLoginView.h"

@interface BaseTableViewController ()<VisitorLoginViewDelegate>

@property (assign, nonatomic) BOOL isLogin;

@end

@implementation BaseTableViewController

- (void)loadView {
    self.isLogin = NO;
    
    self.isLogin ? [super loadView] : (self.view = self.visitorView);
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"登录" style:UIBarButtonItemStylePlain target:self action:@selector(loginButtonClick:)];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"注册" style: UIBarButtonItemStylePlain target:self action:@selector(registerButtonClick:)];
}

-(VisitorLoginView *)visitorView {
    if (_visitorView == nil) {
        _visitorView = [[VisitorLoginView alloc]init];
        _visitorView.delegate = self;
    }
    return _visitorView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
}

#pragma mark - 代理方法
-(void)loginButtonClick:(VisitorLoginView *)visitorView {
    NSLog(@"登录");
}

-(void)registerButtonClick:(VisitorLoginView *)visitorView {
    NSLog(@"注册");
}

@end
